<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<?php
//ket noi db server
$db=mysql_connect("localhost","root","");
if(!$db)
{
	echo "Can not connect to db server!";
	exit;
}
//Chon csdl
mysql_select_db("ql_ban_sua");
//Luu ket qua truy van
$result=mysql_query("select * from khach_hang");
//neu bien result co du lieu
if(mysql_num_rows($result)!=0)
{
	echo "<table width='70%' border='1' align='center' cellpadding='0' cellspacing='0'>
	  <caption>
		THÔNG TIN KHÁCH HÀNG
	  </caption>
	  <tr style='color:#900'>
		<th scope='col'>Mã HK</th>
		<th scope='col'>Tên khách hàng</th>
		<th scope='col'>Giới tính</th>
		<th scope='col'>Địa chỉ</th>
		<th scope='col'>Số điện thoại</th>
	  </tr>";
	  $stt=0;
	  while($row=mysql_fetch_row($result))
	  {
		$maKH=$row[0];
		$tenKH=$row[1];
		$gioiTinh=$row[2];
		if($gioiTinh==0)
			$hinh="<img src='female.jpg' width=20 height=20 alt='img_girl' />";
		else
			$hinh="<img src='male.jpg' width=20 height=20 alt='img_boy' />";		
		$dienThoai=$row[3];
		$diaChi=$row[4];
		if($stt%2==0)
			echo "<tr bgcolor='#FFCCCC'>";
		else
			echo "<tr>";
		echo "<td>$maKH</td>
		<td>$tenKH</td>
		<td>$hinh</td>
		<td>$diaChi</td>
		<td>$dienThoai</td>	  </tr>";
		$stt++;
	  }
	  
	echo "</table>";
}
?>
<body>
</body>
</html>